package cn.itcast.service.impl;

import cn.itcast.dao.AccountDao;
import cn.itcast.domain.Accounts;
import cn.itcast.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class AccountServiceImpl implements AccountService {
    @Autowired
    private AccountDao accountDao;
    @Override
    public List<Accounts> findAll() throws Exception {
        List<Accounts> all = accountDao.findAll();
        return all;
    }

    @Override
    public Accounts findById(int id) throws Exception {
        Accounts byId = accountDao.findById(id);
        return byId;
    }

    @Override
    public void add(Accounts accounts) throws Exception {
        accountDao.add(accounts);

    }

    @Override
    public void update(Accounts accounts) throws Exception {
        accountDao.update(accounts);
    }

    @Override
    public void delete(int id) throws Exception {
       accountDao.delete(id);
    }
}
